﻿'use strict';
angular.module('app')
    .run(
        [
            '$rootScope', '$state', '$stateParams',
            function($rootScope, $state, $stateParams) {
                $rootScope.$state = $state;
                $rootScope.$stateParams = $stateParams;
            }
        ]
    )
    .config(
        [
            '$stateProvider', '$urlRouterProvider',
            function($stateProvider, $urlRouterProvider) {

                $urlRouterProvider
                    .otherwise('/login');
                $stateProvider
                    .state('app', {
                        abstract: true,
                        url: '/app',
                        // templateUrl: 'views/layout1.html',
                        templateUrl: 'views/layout.html',
                        // resolve: {
                        //     deps: [
                        //         '$ocLazyLoad',
                        //         function($ocLazyLoad) {
                        //             return $ocLazyLoad.load({
                        //                 serie: true,
                        //                 files: [
                        //                     'app/controllers/cart.js'
                        //                     // 'app/directives/realtimechart.js'
                        //                 ]
                        //             });
                        //         }
                        //     ]
                        // }
                    })
                    .state('login', {
                        url: '/login',
                        templateUrl: 'views/login.html',
                        ncyBreadcrumb: {
                            label: 'login',
                            description: ''
                        },
                        resolve: {
                            deps: [
                                '$ocLazyLoad',
                                function($ocLazyLoad) {
                                    return $ocLazyLoad.load({
                                        serie: true,
                                        files: [
                                            'app/controllers/login.js',
                                            'assets/icheck/icheck.min.js'
                                            // 'assets/js/template-custom.js'
                                        ]
                                    });
                                }
                            ]
                        }
                    })
                    .state('register', {
                        url: '/register',
                        templateUrl: 'views/register.html',
                        ncyBreadcrumb: {
                            label: 'register',
                            description: ''
                        },
                        resolve: {
                            deps: [
                                '$ocLazyLoad',
                                function($ocLazyLoad) {
                                    return $ocLazyLoad.load({
                                        serie: true,
                                        files: [
                                            'app/controllers/register.js',
                                            'assets/icheck/icheck.min.js'
                                            // 'assets/js/template-custom.js'
                                        ]
                                    });
                                }
                            ]
                        }
                    })
                    .state('app.orderCash', {
                        url: '/orderCash',
                        templateUrl: 'views/orderCash.html',
                        ncyBreadcrumb: {
                            label: 'orderCash',
                            description: ''
                        },
                        resolve: {
                            deps: [
                                '$ocLazyLoad',
                                function($ocLazyLoad) {
                                    return $ocLazyLoad.load({
                                        serie: true,
                                        files: [
                                            'app/controllers/orderCash.js'
                                            // 'app/directives/realtimechart.js'
                                            // 'assets/js/template-custom.js'
                                        ]
                                    });
                                }
                            ]
                        }
                    })
                    // .state('app.shopCart', {
                    //     url: '/orderCash',
                    //     templateUrl: 'views/orderCash.html',
                    //     ncyBreadcrumb: {
                    //         label: 'shopCart',
                    //         description: ''
                    //     },
                    //     resolve: {
                    //         deps: [
                    //             '$ocLazyLoad',
                    //             function($ocLazyLoad) {
                    //                 return $ocLazyLoad.load({
                    //                     serie: true,
                    //                     files: [
                    //                         'app/controllers/orderCash.js'
                    //                         // 'app/directives/realtimechart.js'
                    //                     ]
                    //                 });
                    //             }
                    //         ]
                    //     }
                    // })
                    .state('app.checkOut', {
                        url: '/checkOut',
                        templateUrl: 'views/checkOut.html',
                        ncyBreadcrumb: {
                            label: 'checkOut'
                            // description: 'beyond containers'
                        },
                        controller: 'checkOutCtrl',
                        resolve: {
                            deps: [
                                '$ocLazyLoad',
                                function($ocLazyLoad) {
                                    return $ocLazyLoad.load({
                                        serie: true,
                                        files: [
                                            'app/controllers/checkOut.js',
                                            'assets/js/LodopFuncs.js'
                                            // 'assets/js/template-custom.js'
                                        ]
                                    });
                                }
                            ]
                        }
                    })
                    .state('app.orderForm', {
                        url: '/orderForm',
                        templateUrl: 'views/orderForm.html',
                        ncyBreadcrumb: {
                            label: 'orderForm',
                            // description: 'beyond containers'
                        },
                        resolve: {
                            deps: [
                                '$ocLazyLoad',
                                function($ocLazyLoad) {
                                    return $ocLazyLoad.load({
                                        serie: true,
                                        files: [
                                            'app/controllers/orderForm.js',
                                            'assets/js/LodopFuncs.js',
                                            'https://cdn.bootcss.com/jquery/3.2.1/jquery.js',
                                            'https://cdn.datatables.net/v/dt/dt-1.10.15/datatables.min.js'
                                            // 'assets/js/template-custom.js'
                                            // 'https://cdn.bootcss.com/datatables/1.10.15/js/dataTables.bootstrap.js',
                                            // // 'http://code.jquery.com/jquery-1.10.2.min.js',
                                            // 'http://cdn.datatables.net/1.10.15/js/jquery.dataTables.js',
                                            // 'https://cdn.bootcss.com/datatables/1.10.15/js/dataTables.foundation.js',
                                            // 'https://cdn.bootcss.com/datatables/1.10.15/js/dataTables.jqueryui.js'
                                        ]
                                    });
                                }
                            ]
                        }
                    })
                    .state('app.member', {
                        url: '/member',
                        templateUrl: 'views/member.html',
                        ncyBreadcrumb: {
                            label: 'member',
                            // description: 'flexible containers'
                        },
                        resolve: {
                            deps: [
                                '$ocLazyLoad',
                                function($ocLazyLoad) {
                                    return $ocLazyLoad.load({
                                        serie: true,
                                        files: [
                                            'app/controllers/member.js',
                                            'https://cdn.bootcss.com/jquery/3.2.1/jquery.js',
                                            'https://cdn.datatables.net/v/dt/dt-1.10.15/datatables.min.js',
                                            // 'assets/js/template-custom.js'
                                        ]
                                    });
                                }
                            ]
                        }
                    })
                    .state('app.shopSet', {
                        url: '/shopSet',
                        templateUrl: 'views/shopSet.html',
                        ncyBreadcrumb: {
                            label: 'shopSet',
                            // description: 'Basics'
                        },
                        resolve: {
                            deps: [
                                '$ocLazyLoad',
                                function($ocLazyLoad) {
                                    return $ocLazyLoad.load({
                                        serie: true,
                                        files: [
                                            'app/controllers/shopSet.js',
                                            // 'assets/js/template-custom.js'
                                            // 'assets/js/console-sham.js',
                                            // 'assets/js/console-sham.min.js'
                                            // 'app/controllers/progressbar.js'
                                            // 'https://cdn.bootcss.com/angular-file-upload/2.5.0/angular-file-upload.js',
                                            // 'https://cdn.bootcss.com/angular-file-upload/2.5.0/angular-file-upload.min.js'
                                        ]
                                    });
                                }
                            ]
                        }
                    })
                    .state('app.shopSet_Meng', {
                        url: '/shopSet_Meng',
                        templateUrl: 'views/shopSet_Meng.html',
                        ncyBreadcrumb: {
                            label: 'shopSet_Meng',
                            // description: 'Basics'
                        },
                        resolve: {
                            deps: [
                                '$ocLazyLoad',
                                function($ocLazyLoad) {
                                    return $ocLazyLoad.load({
                                        serie: true,
                                        files: [
                                            'app/controllers/shopSet_Meng.js'
                                            // 'assets/js/template-custom.js'
                                        ]
                                    });
                                }
                            ]
                        }
                    })
                    .state('app.shopMenu', {
                        url: '/shopMenu',
                        templateUrl: 'views/shopMenu.html',
                        ncyBreadcrumb: {
                            label: 'shopMenu',
                            // description: 'Basics'
                        },
                        resolve: {
                            deps: [
                                '$ocLazyLoad',
                                function($ocLazyLoad) {
                                    return $ocLazyLoad.load({
                                        serie: true,
                                        files: [
                                            'app/controllers/shopMenu.js',
                                            // 'app/controllers/progressbar.js'
                                            'http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js',
                                            'http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js'
                                            // 'assets/js/template-custom.js'
                                        ]
                                    });
                                }
                            ]
                        }
                    });
            }
        ]
    );